ASAP
A jQuery plugin for asynchronous page loads.
Demo
Launch the DemoUse
Main
asap.js
Dependencies
jQuery
core.js
analytics.js
Basic
Options
Set instance options by passing a valid object at initialization, or to the public defaults
method.
Name | Type | Default | Description |
---|---|---|---|
cache |
boolean |
true |
Cache AJAX responses |
force |
boolean |
false |
Forces new requests when navigating back/forward |
jump |
boolean |
true |
Jump page to top on render |
modal |
boolean |
false |
Flag for content loaded into modal |
selector |
string |
'a' |
Target DOM Selector |
render |
function |
$.noop |
Custom render function |
requestKey |
string |
'fs-asap' |
GET variable for requests |
transitionOut |
function |
$.noop |
Transition timing callback; should return user defined $.Deferred object, which must eventually resolve |
Events
Events are triggered on the window
, unless otherwise stated.
Event | Description |
---|---|
requested.asap |
Before request is made; triggered on window. Second parameter 'true' if pop event |
progress.asap |
As request is loaded; triggered on window |
loaded.asap |
After request is loaded; triggered on window |
rendered.asap |
After state is rendered; triggered on window |
failed.asap |
After load error; triggered on window |
Methods
Methods are publicly available, unless otherwise stated.
load
Loads new page
$.asap("load", "http://website.com/page/");
Parameters
Name | Type | Default | Description |
---|---|---|---|
opts |
url |
'' |
URL to load |
replace
Updates current url in history
Parameters
Name | Type | Default | Description |
---|---|---|---|
url |
string |
New URL |